package com.ticket.sass.provider.dto.output.cinema;

import com.ticket.sass.common.entity.tenant.ServiceChargeEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Objects;

@Data
@NoArgsConstructor
@ApiModel(description = "服务费用输出模型")
public class ServiceChargeOutput {
    
    @ApiModelProperty(value = "手续费", example = "0.0")
    private BigDecimal handleFee = BigDecimal.ZERO;
    
    @ApiModelProperty(value = "服务费", example = "0.0")
    private BigDecimal serviceFee = BigDecimal.ZERO;
    
    @ApiModelProperty(value = "渠道服务费", example = "0.0")
    private BigDecimal channelServiceFee = BigDecimal.ZERO;
    
    @ApiModelProperty(value = "是否包含在票价", example = "false")
    private Boolean handleFeeContain = Boolean.FALSE;
    
    @ApiModelProperty(value = "是否包含在票价", example = "false")
    private Boolean serviceFeeContain = Boolean.FALSE;
    
    @ApiModelProperty(value = "是否包含在票价", example = "false")
    private Boolean channelServiceFeeContain = Boolean.FALSE;
    
    public ServiceChargeOutput(ServiceChargeEntity entity) {
        if (entity != null) {
            this.handleFee = entity.getHandleFee();
            this.serviceFee = entity.getServiceFee();
            this.channelServiceFee = entity.getChannelServiceFee();
            this.handleFeeContain = entity.getHandleFeeContain();
            this.serviceFeeContain = entity.getServiceFeeContain();
            this.channelServiceFeeContain = entity.getChannelServiceFeeContain();
        }
    }
    
    public static ServiceChargeOutput toOutput(ServiceChargeEntity entity) {
        return Objects.isNull(entity) ? null : new ServiceChargeOutput(entity);
    }
}
